package a.f.g.a.a;

import a.c.e;
import a.c.q;
import a.c.w;
import a.f.o;
import a.f.zc;

import java.util.ArrayList;
import java.util.List;

public abstract class f
{
  protected double a;
  protected double b;
  protected a[][] c = new a[0][0];
  private int d;
  protected double f;
  protected double g;
  public static boolean h;
  public static boolean i;
  
  protected f(double paramDouble1, double paramDouble2)
  {
    this.f = paramDouble1;
    this.g = paramDouble2;
  }
  
  public void a()
  {
    this.a = 0.0D;
    this.b = 0.0D;
    this.c = new a[0][0];
    this.d = 0;
  }
  
  public a a(double paramDouble1, double paramDouble2)
  {
    if (!i) {
      if (this.c.length == 0)
      {
        this.c = new a[1][1];
        this.c[0][0] = d(paramDouble1, paramDouble2);
        b();
        c();
        return this.c[0][0];
      }
    }
    int j = a(paramDouble1);
    int k = b(paramDouble2);
    return a(j, k);
  }
  
  private void a(int paramInt)
  {
    boolean bool2 = i;
    boolean bool1 = h;
    int j = this.c[0].length;
    int k = paramInt + 1;
    a[][] arrayOfa = new a[k][j];
    System.arraycopy(this.c, 0, arrayOfa, 0, this.c.length);
    int m = this.c.length;
    int n = m;
    label168:
    label170:
    do
    {
      if (n >= arrayOfa.length) {
        break;
      }
      double d1 = n * this.g + this.b + this.g / 2.0D;
      a[] arrayOfa1 = arrayOfa[n];
      if ((!bool2) && (bool1)) {
        return;
      }
      int i1 = 0;
      do
      {
        if (i1 >= j) {
          break;
        }
        double d2 = this.c[0][i1].i();
        arrayOfa1[i1] = d(d2, d1);
        i1++;
        if (bool2) {
          break label170;
        }
        if (bool1) {
          break label168;
        }
      } while (!bool1);
      if (!bool2) {
        n++;
      }
    } while (!bool1);
    this.c = arrayOfa;
    if (!bool2) {
      b();
    }
  }
  
  private void b(int paramInt)
  {
    boolean bool2 = i;
    boolean bool1 = h;
    int j = this.c.length;
    int k = j - paramInt;
    int m = this.c[0].length;
    a[][] arrayOfa = new a[k][m];
    System.arraycopy(this.c, 0, arrayOfa, k - j, this.c.length);
    int n = -1;
    label171:
    label173:
    do
    {
      if (n < paramInt) {
        break;
      }
      a[] arrayOfa1 = arrayOfa[(n - paramInt)];
      double d1 = n * this.g + this.b + this.g / 2.0D;
      if ((!bool2) && (bool1)) {
        return;
      }
      int i1 = 0;
      do
      {
        if (i1 >= m) {
          break;
        }
        double d2 = this.c[0][i1].i();
        arrayOfa1[i1] = d(d2, d1);
        i1++;
        if (bool2) {
          break label173;
        }
        if (bool1) {
          break label171;
        }
      } while (!bool1);
      if (!bool2) {
        n--;
      }
    } while (!bool1);
    this.c = arrayOfa;
    c();
    if (!bool2) {
      b();
    }
  }
  
  private void c(int paramInt)
  {
    boolean bool2 = i;
    boolean bool1 = h;
    int j = this.c.length;
    int k = paramInt + 1;
    a[][] arrayOfa = new a[j][k];
    int m = 0;
    if (m < j) {}
    label160:
    label162:
    do
    {
      a[] arrayOfa1 = this.c[m];
      a[] arrayOfa2 = arrayOfa[m];
      System.arraycopy(arrayOfa1, 0, arrayOfa2, 0, arrayOfa1.length);
      double d1 = arrayOfa1[0].g();
      if ((!bool2) && (bool1)) {
        return;
      }
      int n = arrayOfa1.length;
      do
      {
        if (n >= arrayOfa2.length) {
          break;
        }
        double d2 = n * this.f + this.a + this.f / 2.0D;
        arrayOfa2[n] = d(d2, d1);
        n++;
        if (bool2) {
          break label162;
        }
        if (bool1) {
          break label160;
        }
      } while (!bool1);
      if (!bool2) {
        m++;
      }
      if (!bool1) {
        break;
      }
      this.c = arrayOfa;
    } while (bool2);
    b();
  }
  
  private void d(int paramInt)
  {
    boolean bool2 = i;
    boolean bool1 = h;
    int j = this.c[0].length;
    int k = this.c.length;
    int m = j - paramInt;
    a[][] arrayOfa = new a[k][m];
    int n = 0;
    if (n < k) {}
    label171:
    label173:
    do
    {
      a[] arrayOfa1 = this.c[n];
      a[] arrayOfa2 = arrayOfa[n];
      System.arraycopy(arrayOfa1, 0, arrayOfa2, m - j, arrayOfa1.length);
      double d1 = arrayOfa1[0].g();
      if ((!bool2) && (bool1)) {
        return;
      }
      int i1 = -1;
      do
      {
        if (i1 < paramInt) {
          break;
        }
        double d2 = i1 * this.f + this.a + this.f / 2.0D;
        arrayOfa2[(i1 - paramInt)] = d(d2, d1);
        i1--;
        if (bool2) {
          break label173;
        }
        if (bool1) {
          break label171;
        }
      } while (!bool1);
      if (!bool2) {
        n++;
      }
      if (!bool1) {
        break;
      }
      this.c = arrayOfa;
      c();
    } while (bool2);
    b();
  }
  
  private void b()
  {
    if (!i) {
      if (this.c.length == 0)
      {
        this.d = 0;
        return;
      }
    }
    this.d = (this.c.length * this.c[0].length);
  }
  
  int b(double paramDouble1, double paramDouble2)
  {
    boolean bool = i;
    double d1 = paramDouble1 / paramDouble2;
    if (!bool) {
      if (d1 < 0.0D)
      {
        j = (int)Math.floor(d1);
        if (bool) {
          break label48;
        }
        if (!h) {
          break label46;
        }
      }
    }
    int j = (int)d1;
    label46:
    label48:
    return j;
  }
  
  private void c()
  {
    if (!i)
    {
      if (this.d == 0) {
        return;
      }
      this.a = this.c[0][0].d();
    }
    this.b = this.c[0][0].e();
  }
  
  protected a d(double paramDouble1, double paramDouble2)
  {
    return new a(paramDouble1, paramDouble2, this.f, this.g);
  }
  
  public int d()
  {
    return this.d;
  }
  
  public a[][] e()
  {
    return this.c;
  }
  
  public void a(o paramo)
  {
    boolean bool = h;
    w localw = paramo.v();
    do
    {
      if (!localw.e()) {
        break;
      }
      e locale = localw.d();
      a(locale, paramo.k(locale));
      localw.f();
    } while (!bool);
  }
  
  public abstract void a(e parame, zc paramzc);
  
  public abstract void c(e parame, zc paramzc);
  
  protected a a(int paramInt1, int paramInt2)
  {
    boolean bool = i;
    if (!bool) {
      if (paramInt1 < 0)
      {
        d(paramInt1);
        paramInt1 = 0;
      }
    }
    if (!bool) {
      if (paramInt2 < 0)
      {
        b(paramInt2);
        paramInt2 = 0;
      }
    }
    if (!bool) {
      if (paramInt1 >= this.c[0].length) {
        c(paramInt1);
      }
    }
    if (paramInt2 >= this.c.length) {
      a(paramInt2);
    }
    return this.c[paramInt2][paramInt1];
  }
  
  protected int a(double paramDouble)
  {
    return b(paramDouble - this.a, this.f);
  }
  
  protected int b(double paramDouble)
  {
    return b(paramDouble - this.b, this.g);
  }
  
  public List a(a parama)
  {
    boolean bool2 = i;
    boolean bool1 = h;
    ArrayList localArrayList = new ArrayList(Math.max(1, this.d - 4));
    int j = 0;
    label167:
    do
    {
      if (j >= this.c.length) {
        break;
      }
      a[] arrayOfa = this.c[j];
      int k = 0;
      do
      {
        do
        {
          if (k >= arrayOfa.length) {
            break label167;
          }
          a locala = arrayOfa[k];
          if (bool1) {
            break;
          }
          if ((locala.l() != 0) && ((bool2) || (locala != parama)) && ((bool2) || ((Math.abs(locala.i() - parama.i()) > this.f) || ((bool2) || (Math.abs(locala.g() - parama.g()) > this.g))))) {
            localArrayList.add(locala);
          }
          k++;
        } while (!bool1);
        j++;
      } while (bool2);
    } while (!bool1);
    return localArrayList;
  }
  
  public List b(a parama)
  {
    boolean bool2 = i;
    boolean bool1 = h;
    int j = a(parama.i());
    int k = b(parama.g());
    ArrayList localArrayList = new ArrayList(8);
    a(localArrayList, j - 1, k - 1);
    a(localArrayList, j, k - 1);
    a(localArrayList, j + 1, k - 1);
    a(localArrayList, j - 1, k);
    a(localArrayList, j + 1, k);
    a(localArrayList, j - 1, k + 1);
    a(localArrayList, j, k + 1);
    a(localArrayList, j + 1, k + 1);
    if ((bool2) || (bool1))
    {
      if (!bool2) {}
      q.n = !q.n;
    }
    if (bool2) {
      q.o = !q.o;
    }
    return localArrayList;
  }
  
  private void a(List paramList, int paramInt1, int paramInt2)
  {
    boolean bool = i;
    if (!bool) {
      if (paramInt1 < 0) {
        return;
      }
    }
    if (!bool) {
      if (paramInt1 >= this.c[0].length) {
        return;
      }
    }
    if (!bool) {
      if (paramInt2 < 0) {
        return;
      }
    }
    if (!bool) {
      if (paramInt2 >= this.c.length) {
        return;
      }
    }
    paramList.add(this.c[paramInt2][paramInt1]);
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.g.a.a.f

 * JD-Core Version:    0.7.0.1

 */